package com.jt.tenant.conn;

import com.jt.tenant.app.JTApplication;
import com.jt.tenant.widget.Tools;
import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;

import org.json.JSONObject;

/**
 * Created by AD on 2016/5/12.
 */
@HttpInlet(Conn.INLET_GET_INTEGRAL_NEW)
public class GetIntegral extends JTAsyGet<GetIntegral.Info> {
    public String token = JTApplication.jtPreferences.readToken();
    public String userId = JTApplication.jtPreferences.readUserID();


    public GetIntegral(AsyCallBack<Info> asyCallBack) {
        super(asyCallBack);
    }

    @Override
    protected Info parser(JSONObject object) {

        JSONObject apiTYF = object.optJSONObject("apiTYF");

        JSONObject head = apiTYF.optJSONObject("head");

        Info info = new Info();

        info.msg = head.optString("msg");

        info.code = head.optString("code");

        JSONObject body = apiTYF.optJSONObject("body");

        info.todayCount = Tools.F_num(body.optString("todayCount"));

        info.integralCount = Tools.F_num(body.optString("integralCount"));

        info.commonCount = Tools.F_num(body.optString("commonCount"));

        return info;
    }

    public static class Info{
        public String msg;

        public String code;

        public String todayCount;

        public String integralCount;

        public String commonCount;


    }

}
